package com.qzdsoft.erpcloud.controller.sys;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.qzdsoft.erpcloud.service.sys.Permission;
import com.qzdsoft.erpcloud.service.sys.SysTableAuthFieldService;
import com.qzdsoft.erpcloud.vo.sys.SysTableAuthFieldQueryInfo;

/**
 * Created by Admin
 * 表格权限设置(角色)
 */
@Controller
@RequestMapping("/sys/role/table/field")
public class SysRoleTableFieldController {
	private static final Logger logger = LoggerFactory.getLogger(SysRoleTableFieldController.class);
	
	@Autowired
	private SysTableAuthFieldService sysTableAuthFieldService;
	
	/**
	 * 根据 tableId roleId查询表格字段，回显选择
	 * @param tableId
	 * @return
	 */
	@Permission(validate=false)
	@RequestMapping("/fields")
	public ModelAndView fields(Integer tableId,Integer roleId) {
		logger.debug("tableId={},roleId={}",tableId,roleId);
		ModelAndView mv = new ModelAndView();
//		SysTableAuthFieldQueryInfo info = new SysTableAuthFieldQueryInfo();
//		info.setTableId(tableId);
		mv.addObject("details", sysTableAuthFieldService.selectByTableId(tableId,roleId));
		mv.setViewName("sys/role_table/fields");
		return mv;
	}
	
}
